import os
import shutil

count = 0
with open("./temp1.txt", "r", encoding="utf-8") as f:
    for line in f:
        line = line.strip()
        if not line:
            continue
        count += 1
        app_no, srcFile, pub_no = line.split("\t")
        dstDir = os.path.join(r"E:\样例数据\cnipapatent\cnipapatent_cover_20181029", pub_no[:3].lower(), pub_no[3:7].lowor)
        if not os.path.exists(dstDir):
            os.makedirs(dstDir)
        dstFile = os.path.join(dstDir, pub_no + ".jpg")
        # print('%s -> %s' % (srcFile, dstFile))
        if count % 100 == 1:
            print(count)
        shutil.copy(srcFile, dstFile)
print("Total %d" % count)
